﻿@using EC.Entity.Response.User
@using EC.Entity.Enum

@model EC.Entity.PagedList<UserQueryResponse>

<div class="data-body data-scroll">
    <div class="data-view">
        <div class="data-div-view table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                        <th class="t_l">商户</th>
                        <th class="t_l" width="150">用户名称</th>
                        <th width="130">创建时间</th>
                        <th width="75">状态</th>
                        <th width="180">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.TData != null && Model.TData.Any())
                    {
                        foreach (var item in (List<EC.Entity.Response.User.UserQueryResponse>)Model.TData)
                        {
                            <tr>
                                <td class="t_l">@(item.MerchantName)</td>
                                <td class="t_l" width="100">
                                    @if (string.IsNullOrEmpty(item.UserGroupName))
                                    {
                                        <span>@(item.Account)</span>
                                    }
                                    else
                                    {
                                        <span>@(item.Account)(@(item.UserGroupName))</span>
                                    }
                                </td>
                                <td width="130">@(item.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss"))</td>
                                <td width="75">
                                    @(item.Status == (sbyte)UserStatus.启用?Html.Raw("<span class='green bold'>启用</span>"):Html.Raw("<span class='red bold'>禁用</span>"))
                                </td>
                                <td width="180">
                                    @if (item.GoogleVerifyStatus == (sbyte)GoogleVerifyStatus.启用)
                                    {
                                        <a class="btn btn-danger btn-xs" data-confirm="确定要禁用该用户？" data-succesFun="doSearch()" data-href="/Business/GoogleVerifyStatu?id=@(item.Id)&status=@((sbyte)GoogleVerifyStatus.禁用)">禁用Google</a>
                                    }
                                    else
                                    {
                                        <button type="button" class="btn btn-default btn-xs" data-modal="/Business/GoogleVerify" data-title="启用Google" data-width="300" data-height="300">
                                            <span class="glyphicon glyphicon-edit"></span> 启用Google
                                        </button>
                                    }
                                <button type="button" class="btn btn-default btn-xs" data-modal="/Business/ConfirmPassWord/@(item.Id)" data-title="交易密码" data-width="430" data-height="260">
                                    <span class="glyphicon glyphicon-edit"></span> 交易密码
                                </button>
                                </td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="6" class="t_c">暂无记录</td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- 必要的分页参数设置 -->
<input type="hidden" id="TotalCount" value="@(Model != null ? Model.TotalCount : 0)" />